
package edu.netjava.collection;

import java.util.Iterator;
import java.util.Vector;
/**
 * @description: this class implements a queue with vector
 * @author tan
 * 
 */

public class QueueAcorrdingtoVector {
	
	
	Vector<Object>  vec = new Vector<Object>();
	int size;
	/**
	 * 
	 * @param object:the element to append to the last of the queue
	 */
	public void add(Object object){
		
		size++;
		vec.add(object);
		
	}
	
	/**
	 * 
	 * @return: the element according to index in the queue
	 */
    public Object get(int index){
    	return vec.get(index);
    }
	
    /**
     * 
     * @return: the first element in the queue
     *          delete the returned element at the same time
     *          
     */
    public Object delete(){
    	size--;
    	return vec.remove(0);
    }
    
    /**
     * 
     * @return: the iterator of the queue
     */
    Iterator<Object> iterator() {
    	
		return vec.iterator();
	}


	
	
	

}
